﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Profile;
using System.Data;

namespace WebSite.admin.member
{
    public partial class member_msg_add : BaseAdmin
    {

        // Methods
        private void Bind()
        {
            DataTable table = SQLAccess.GreatDs("select * from DB_Msg where msgid=" + re.replace(base.Request.QueryString["mid"]) + "").Tables[0];
            if (table.Rows.Count > 0)
            {
                this.title.Text = table.Rows[0]["title"].ToString();
                this.replays.Text = table.Rows[0]["replay"].ToString();
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            SQLAccess.DoSql(string.Concat(new object[] { "update DB_Msg set replay='", re.replace(base.Request.Form["replays"]), "',states=1,replaytime='", DateTime.Now, "',isnew=1,adminid=" + base.AdminUserId + " where msgid=", re.replace(base.Request.QueryString["mid"]), "" }));
            base.Response.Write("<script language='javascript'>alert('添加处理成功！');window.location.href='member_msg.aspx?mid=" + base.Request.QueryString["mid"] + "';</script>");
            base.Response.End();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Session["Adminlogin"] == null)
            {
                base.Response.Write("<script language=javascript>window.top.location.href='../login.aspx';</script>");
                base.Response.End();
            }
            if (base.Request.QueryString["mid"] != null)
            {
                this.Bind();
            }
        }

    }
}